<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>客户管理</title>
    <link href="../../css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="../../js/jquery.js"></script>
    <script type="text/javascript" src="../../js/vue.js"></script>
    <script type="text/javascript" src="../../js/axios.min.js"></script>

    <script type="text/javascript">
        var namePro = 0;

        function deltipOpen() {
            $("#deltip").fadeIn(200);
        }

        function deltipClose() {
            $("#deltip").fadeOut(200);
        }

        function examinetipOpen(name) {
            namePro = name;
            $("#examinetip").fadeIn(200);
        }

        function examinetipclose() {
            $("#examinetip").fadeOut(200);
        }

        // 发送审核
        function executeGetAjax() {
            <!--  data中传递json对象  -->
            $.ajax({
                url: '/purchaseOrderManage/sendApproval?namePro=' + namePro,
                type: 'post',
                async: true,
                dataType: 'text',
                success: function (data) {
                }
            })
            examinetipclose();
        };

    </script>
</head>

<body>
<div class="place"><span>位置：</span>
    <ul class="placeul">
        <li>采购管理</li>
        <li>采购单管理</li>
        <li>基本内容</li>
    </ul>
</div>
<div class="rightinfo">
    <form action="/purchaseOrderManage/vaguePurchaseOrderManage" method="post">
        <ul class="tools">
            <li> 采购单编号:
                <input name="purchaseId" type="text" value=""/>
            </li>
            <li> 采购时间:
                <label for="date1"><input type="date" id="date1" name="date1" value=""/></label>-<label
                        for="date2"><input
                        type="date" id="date2" name="date2" value=""/></label>
            </li>
            <li> 金额:
                <input type="text" class="stinput" name="totalMoney1" value=""
                       oninput="if(!/^[0-9]+$/.test(value)) value=value.replace(/\D/g,'');if(value>50000000)value=50000000;if(value<1)value=1"/>-<input
                        type="text" class="stinput"
                        oninput="if(!/^[0-9]+$/.test(value)) value=value.replace(/\D/g,'');if(value>50000000)value=50000000;if(value<1)value=1"
                        name="totalMoney2" value=""/>
            </li>
            <li> 审核状态：
                <select name="checkStatus">
                    <option value="0">请选择</option>
                    <option value="1">未审核</option>
                    <option value="2">审核中</option>
                    <option value="3">审核通过</option>
                    <option value="4">审核未通过</option>
                </select>
            </li>
            <input type="submit" class="subBut" value="查询">
            <a th:href="@{'/purchaseOrderManage/addGetDatePurchase'}" class="subBut">添加</a>

        </ul>
        <table class="tablelist">
            <thead>
            <tr>
                <th>序号</th>
                <th>采购单编号</th>
                <th>采购时间</th>
                <th>金额</th>
                <th>操作人</th>
                <th>审核状态</th>
                <th>审核人</th>
                <th>审核时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            <tr th:each="p:${PurchaseOrderManage.data}">
                <td>[[${pStat.index + 1}]]</td>
                <td>[[${p.purchaseId}]]</td>
                <td>[[${#dates.format(p.purchaseTime, 'yyyy-MM-dd HH:mm')}]]</td>
                <td>[[${p.totalMoneyTemp}]]</td>
                <td>
                    [[${p.uname}]]
                </td>
                <td>
                    <span th:if="${p.checkStatus} eq 1">未审核</span>
                    <span th:if="${p.checkStatus} eq 2">审核中</span>
                    <span th:if="${p.checkStatus} eq 3">审核通过</span>
                    <span th:if="${p.checkStatus} eq 4">审核未通过</span>
                </td>
                <td>管理员</td>
                <td>[[${#dates.format(p.checkTime, 'yyyy-MM-dd HH:mm')}]]</td>
                <td>

          <span th:if="${p.checkStatus} eq 1">
            <a th:href="@{/purchaseOrderManage/updateGetDatePurchase/{id}
                    (id=${p.purchaseId})}" class="tablelink">修改</a>
            <a th:href="@{/purchaseOrderManage/deletePurchaseOrderManage/{id}
                    (id=${p.purchaseId})}" class="tablelink">删除</a>

              <a href="#" class="tablelink" th:data-t_id="${p.purchaseId}"
                 th:onclick="examinetipOpen(this.getAttribute('data-t_id'))">提交审核</a>

          </span>
                    <span th:if="${p.checkStatus} eq 2">
            <a th:href="@{/purchaseOrderManage/getOnePurchaseOrderManage/{id}
                    (id=${p.purchaseId})}" class="tablelink">查看详情</a>
          </span>

            <span th:if="${p.checkStatus} eq 3">
                <a th:href="@{/purchaseOrderManage/getOnePurchaseOrderManage/{id}
                        (id=${p.purchaseId})}" class="tablelink">查看详情</a>
                <a th:href="@{/purchaseOrderManage/purchaseWarehousingDetails/{id}
                        (id=${p.purchaseId})}" class="tablelink">入库详情</a>
          </span>

                    <span th:if=" ${p.checkStatus} eq 4">
            <a th:href="@{/purchaseOrderManage/updateGetDatePurchase/{id}
                    (id=${p.purchaseId})}" class="tablelink">修改</a>
            <a href="#" class="tablelink" th:data-t_id="${p.purchaseId}"
               th:onclick="examinetipOpen(this.getAttribute('data-t_id'))">提交审核</a>
          </span>
                </td>
            </tr>

            </tbody>
        </table>
        <span  onload="cDetailedPurchasesFlag()">
        </span>

        <div class="pagin">

            <div class="message">共<i class="blue">[[${PurchaseOrderManage.totalRows}]]</i>条记录，当前显示第&nbsp;<i
                    class="blue">[[${PurchaseOrderManage.pageNum}]]&nbsp;</i>页
            </div>
            <ul class="paginList">

                <span th:if="${PurchaseOrderManage.totalPage < 3}">
                       <li class="paginItem" th:if="${PurchaseOrderManage.pageNum>1}"><a
                               th:href="@{${'purchaseOrderList'}(pageNum=${PurchaseOrderManage.pageNum-1})}"><span
                               class="pagepre"></span></a>
                </li>
                        <li class="paginItem"><a th:href="@{${'purchaseOrderList'}(pageNum=${1})}">1</a></li>
                        <li class="paginItem current"><a th:href="@{${'purchaseOrderList'}(pageNum=${2})}">2</a></li>
                </span>

                <span th:if="${PurchaseOrderManage.totalPage >= 3}">
                <li class="paginItem" th:if="${PurchaseOrderManage.pageNum>1}"><a
                        th:href="@{${'purchaseOrderList'}(pageNum=${PurchaseOrderManage.pageNum-1})}"><span
                        class="pagepre"></span></a>
                </li>
                <li class="paginItem"><a th:href="@{${'purchaseOrderList'}(pageNum=${1})}">1</a></li>
                <li class="paginItem current"><a th:href="@{${'purchaseOrderList'}(pageNum=${2})}">2</a></li>
                <li class="paginItem more"><a href="javascript:;">...</a></li>
                <li class="paginItem"><a th:href="@{${'purchaseOrderList'}(pageNum=${PurchaseOrderManage.totalPage})}">[[${PurchaseOrderManage.totalPage}]]</a>
                </li>
                <li class="paginItem" th:if="${PurchaseOrderManage.pageNum<=PurchaseOrderManage.totalPage-1}"><a
                        th:href="@{${'purchaseOrderList'}(pageNum=${PurchaseOrderManage.pageNum+1})}"><span
                        class="pagenxt"></span></a>
                </li>
                </span>

            </ul>
        </div>

    </form>
    <!-- 删除提示框 -->
    <div id="deltip" class="tip">
        <div class="tiptop"><span>提示信息</span><a onclick="deltipClose()"></a></div>
        <div class="tipinfo"><span><img src="../../images/ticon.png"/></span>
            <div class="tipright">
                <p>是否确认删除此条信息？</p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite></div>
        </div>
        <div class="tipbtn">
            <input name="" type="button" class="sure" value="确定" onclick="executeGetAjax(namePro)"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="deltipClose()"/>
        </div>
    </div>

    <!-- 审批提示框 -->
    <div id="examinetip" class="tip">
        <div class="tiptop">
            <span>提示信息</span><a onclick="examinetipclose()"></a>
        </div>
        <div class="tipinfo1">

            部门：
            <select class="dfselect">
                <option>请选择</option>
                <option>销售部</option>
                <option>采购部</option>
                <option>财务部</option>
            </select>
            <p/>
            职位：
            <select class="dfselect">
                <option>请选择</option>
                <option>部门经理</option>
                <option>部门副经理</option>
                <option>部门主管</option>
            </select>
            <p/>
            姓名：
            <select class="dfselect">
                <option>请选择</option>
                <option>刘备</option>
                <option>曹操</option>
            </select>
            <p/>
        </div>
        <div class="tipbtn">
            <input name="" type="button" class="sure" value="确定" onclick="executeGetAjax(name)"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="examinetipclose()"/>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');

    function cDetailedPurchasesFlag(){
        alert("仓库没有此订单")
    }
</script>
</body>
</html>
